from rest_framework import serializers

from .models import Case, Endpoint


class EndpointSerializer(serializers.ModelSerializer):
    class Meta:
        model = Endpoint
        fields = "__all__"


class CaseSerializer(serializers.ModelSerializer):
    endpoint = serializers.PrimaryKeyRelatedField(queryset=Endpoint.objects.all())
    endpoint_detail = EndpointSerializer(source="endpoint", read_only=True)

    class Meta:
        model = Case
        fields = "__all__"
